generated from falcosecurity/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(decl/loader): set up JSON schema validation of the input #248
Merged
poiana
merged 5 commits into
falcosecurity:declarative-testing
from
ekoops:ekoops/loader
Dec 10, 2024
Merged
feat(decl/loader): set up JSON schema validation of the input #248
poiana
merged 5 commits into
falcosecurity:declarative-testing
from
ekoops:ekoops/loader
Dec 10, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Leonardo Di Giovanna <[email protected]> Co-authored-by: Aldo Lacuku <[email protected]>
ekoops
changed the title
feat(decl/loader): set up two-steps unmarshaling via mapstructure and replace
wip: feat(decl/loader): set up two-steps unmarshaling via mapstructure and replace Dec 6, 2024
go-yaml/yaml
go-yaml/yaml
ekoops
changed the title
wip: feat(decl/loader): set up two-steps unmarshaling via mapstructure and replace
feat(decl/loader): set up JSON schema validation of the input
Dec 6, 2024
go-yaml/yaml
Signed-off-by: Leonardo Di Giovanna <[email protected]> Co-authored-by: Aldo Lacuku <[email protected]>
Unmarshal tests description in two steps: the first step performs the YAML-specific conversion of the description into a generic representation; the second step takes the generic representation and uses mapstructure to place the content in the right structures. Splitting the unmarshalling in two steps enables performing the validation logic (through JSON schemas) before placing the content in the corresponding structures. Signed-off-by: Leonardo Di Giovanna <[email protected]> Co-authored-by: Aldo Lacuku <[email protected]>
Replace go-yaml/yaml as it is practically not maintained anymore and requires additional code to be written for marshalling structures specifying 'inline' on any on their fields. Signed-off-by: Leonardo Di Giovanna <[email protected]> Co-authored-by: Aldo Lacuku <[email protected]>
Signed-off-by: Leonardo Di Giovanna <[email protected]> Co-authored-by: Aldo Lacuku <[email protected]>
leogr
approved these changes
Dec 10, 2024
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ekoops, leogr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
LGTM label has been added. Git tree hash: c57554b747d7893c2f73ead5f4a60a3c7e4107cf
|
poiana
merged commit Dec 10, 2024
ca62f90
into
falcosecurity:declarative-testing
5 of 6 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
/kind feature
Any specific area of the project related to this PR?
/area pkg
What this PR does / why we need it:
This PR introduces tests description validation through JSON schemas. Besides validation, JSON schemas allow to document the test description sections in an easily parsable format: this provides foundation for CLI commands aiming to expose sections documentation to the user.
In order to perform validation through JSON schemas, the
loader
has been modified to unmarshal tests description in two steps:The JSON schema validation is performed, on the generic representation, between the two steps.
This PR also replaces the unmaintained
go-yaml/yaml
withgoccy/go-yaml
, and fixes the field bindings marshaling for nested fields.The high number of line additions is due to the introduction of the JSON schemas.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: